
import { searchOption, columns, mockdata, warningArr, proposedMeasures, acceptanceRecord } from './model.js'
export default {
    data() {
        return {
            // 登录人信息
            userInfo: JSON.parse(sessionStorage.getItem('ycloud-user_info'))
        }
    },
    methods: {
        // 处理预警name
        filterWarningName(text) {
            return warningArr.filter((v) => v.value === text)[0].label
        },
        // 处理拟采取措施name
        filterProposedMeasuresName(text) {
            return proposedMeasures.filter((v) => v.value === text)[0].label
        },
        // 验收记录name text: checkStatus
        filterAcceptanceRecordName(text, { measureStatus }) {
            if (measureStatus === 2 && text === 0) return '待验收'
            return acceptanceRecord.filter((v) => v.value === text)[0].label
        },
        // 处理操作按钮的显示
        handlerOperaBtns({ measureStatus, checkStatus }) {
            let status = -1
            switch (measureStatus) {
                // 拟采取措施-待提交状态 && 当前账号为接收人
                case 0:
                    status = 0
                    break;
                // 拟采取措施-审核中状态
                case 1:
                    status = 1
                    break;
                // 拟采取措施-审核不通过
                case 3:
                    status = 3
                    break;
                // 拟采取措施-审核通过
                case 2:
                    // 记录状态：待验收
                    if (checkStatus === 1 || checkStatus === 0) {
                        status = 2
                    }
                    // 记录状态：验收中
                    if (checkStatus === 2) {
                        status = 4
                    }
                    // 记录状态：验收通过
                    if (checkStatus === 3) {
                        status = 6
                    }
                    // 记录状态：验收不通过
                    if (checkStatus === 4) {
                        status = 5
                    }
                    break;
            }
            return status
        },
    }
}